import java.util.Arrays;

/**
 * @author JiuQi 玖柒
 * @date 2021/7/6 0:09
 */
public class T217 {
    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 1};
        System.out.println(new Solution2().containsDuplicate(nums));
    }
}

class Solution2 {
    public boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        int right = nums.length - 1;
        for (int left = 0; left < right; left++) {
            if (nums[left] == nums[left + 1]) return true;
        }
        return false;
    }
}

